using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

using EntLibEC.Cmn;
using EntLibEC.Biz;

namespace EntLibEC.View.Report
{
	/// <summary>
	/// Summary description for SysLoginReport.
	/// </summary>
	public partial class SysLoginReport : PageBase
	{

		protected EntLibEC.View.Cmn.UserTime ucTimeFrom ;
		protected EntLibEC.View.Cmn.UserTime ucTimeTo;
		protected EntLibEC.View.Cmn.User ucUser;
	
		protected void Page_Load(object sender, System.EventArgs e)
		{
			if(!Page.IsPostBack)
			{
			    ucTimeFrom.InitControl();
				ucTimeTo.InitControl();				
			}
		
		}

		#region Web Form Designer generated code
		override protected void OnInit(EventArgs e)
		{
			//
			// CODEGEN: This call is required by the ASP.NET Web Form Designer.
			//
			InitializeComponent();
			base.OnInit(e);
		}
		
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{    

		}
		#endregion

		protected void btnSearch_Click(object sender, System.EventArgs e)
		{		   
			try
			{
				Hashtable ht = new Hashtable();
				ht.Add("TimeFrom" , ucTimeFrom.GetTime());
				ht.Add("TimeTo" , ucTimeTo.GetTime());
				if(ucUser.UserSysNo != AppConst.IntNull)
					ht.Add("UserSysNo" , ucUser.UserSysNo);

				DataSet ds = LogManager.GetInstance().GetLogin(ht);

				dgLogin.DataSource = ds;
				dgLogin.DataBind();
				Assert(lblMessage , ds.Tables[0].Rows.Count.ToString() + " Record(s)" , 1);
			}
			catch(BizException exp)
			{
			    Assert(lblMessage , exp.Message , -1);
				return;
			}
			catch
			{
				Assert(lblMessage , "Unknow Error!" , -1);
				return;				
			}			

		}
		
	}
}
